var params = {
    ctmid:'4376502',
    csid:'327'
};

function getpro(callback) {
    coapi.getJobSchedule(params,function(data){
        console.log("行程信息",data);
       return callback ? callback(data) : "";
    }, params);
}

function showtable(data) {
    var info;
    var typeinfo = "";
    var tempArr = [];//存储组别类型的数量
    var tableInfo = data.resultbody.schedulelist;
    console.log("行程Json",tableInfo);
    //合并表格，push数组
    for (var i in tableInfo){
        if(tableInfo[i].memo2!==typeinfo){
            tempArr.push(i);
            typeinfo = tableInfo[i].memo2;
        }else {

        }
    }
    console.log(tempArr);
    //数组存储的为同类的首项的第一个编号
    //数组操作
    //逐项相减
    var typenum = [];
    for (var i=0;i<tempArr.length;i++){
        if (i===tempArr.length-1){
            typenum.push(tableInfo.length-tempArr[i]);
        }else {
            typenum.push(tempArr[i+1]-tempArr[i]);
        }
    }
    console.log(typenum,"real");

    var zu ;
    var num = 0;
    for (var i in tableInfo){
        if (zu!==tableInfo[i].memo2){
            zu=tableInfo[i].memo2;
            info+=
                "<tr>\n" +
                "     <td rowspan='"+typenum[num]+"' style='background-color:#EEEEEE '>"+tableInfo[i].memo2+"</td>\n" +
                "     <td>"+tableInfo[i].school+"</td>\n" +
                "     <td>"+tableInfo[i].memo1+"</td>\n" +
                "     <td>"+tableInfo[i].city+"</td>\n" +
                "     <td>"+tableInfo [i].cdate+"</td>\n" +
                "</tr>";
            num++;
        } else {
            info+=
                "<tr>\n" +
                "     <td>"+tableInfo[i].school+"</td>\n" +
                "     <td>"+tableInfo[i].memo1+"</td>\n" +
                "     <td>"+tableInfo[i].city+"</td>\n" +
                "     <td>"+tableInfo [i].cdate+"</td>\n" +
                "</tr>"
        }
    }
    $(".innerTable").html(info);
    var _this_tr = $(".innerTable tr");
    for (var i in _this_tr){
        i%2===0 ? _this_tr.eq(i).css("background-color","#EEEEEE") : "";
    }
}
getpro(showtable);